package com.qf.medicaldoctoradmin.onlineSigning.TeamHomepage.controller;


import com.qf.common.annotation.NoLoginCheck;
import com.qf.common.common.R;
import com.qf.common.entity.Doctor;
import com.qf.medicaldoctoradmin.onlineSigning.TeamHomepage.service.DoctorService;
import com.qf.medicaldoctoradmin.onlineSigning.TeamHomepage.vo.TeamHomepageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "医生管理")
@RestController
@RequestMapping("/doctor")
@CrossOrigin
public class DoctorController {

    @Resource
    private DoctorService doctorService;


    @ApiOperation(value = "获取医生信息", notes = "根据医生的id,获取医生信息")
    @GetMapping ("/DoctorById")
    public R DoctorById(Integer id) {
        Doctor doctor = doctorService.selectById(id);
        return R.ok(doctor);
    }


    @ApiOperation(value = "获取所有团队及团队下的医生", notes = "申请签约中,选择对应的团队，下面对应的签约医生也会改变")
    @GetMapping ("/SignTeamDoctorAll")
    public R SignTeamDoctorAll() {
        List<TeamHomepageVo> teamHomepageVos = doctorService.SignTeamDoctorAll();
        return R.ok(teamHomepageVos);
    }



    @ApiOperation(value = "申请签约", notes = "需要一个对应的的医生的id,需要签约用户的uid")
    @GetMapping ("/DoctorByIdSign")
    public R DoctorByIdSign(@RequestParam("id") Integer id, @RequestParam("uid") Integer uid) {
        doctorService.DoctorByIdSign(id,uid);
        return R.ok();
    }


}
